using Sustainalytics.ESGRatings.Computing.Entities;
using System;
using System.Collections;

namespace Sustainalytics.ESGRatings.BusinessLogic.Computing
{
    public struct IndicatorDataStruct
    {
        public byte IsNotNan;
        public float Score;
        public float? Weight;
        public float? WeightedScore;

        public static void SetNotNaNValue(ref IndicatorDataStruct item, float value, float? weight = null, float? weightedScore = null)
        {
            item.IsNotNan = 1;
            item.Score = value;
            item.WeightedScore = weightedScore;
            item.Weight = weight;
        }

        public static IndicatorDataStruct Default()
        {
            var indicator = new IndicatorDataStruct();
            indicator.IsNotNan = 0;
            indicator.Score = -1;
            return indicator;
        }
    }

    public struct WeightMatrixStruct
    {
        public Guid MatrixId;
        public int MatrixInternalId;
        public BitArray IsNaN;


    }

    public struct CompanyScoresStruct
    {
        public Rating[] CompanyRatings { get; private set; }
        public CompanyScoresStruct(CompanyScores companyScore)
        {
            CompanyRatings = new Rating[8];
            CompanyRatings[0] = companyScore.OverallRating;
            CompanyRatings[1] = companyScore.EnvironmentRating;
            CompanyRatings[2] = companyScore.SocialRating;
            CompanyRatings[3] = companyScore.GovernanceRating;
            CompanyRatings[4] = companyScore.DisclosureRating;
            CompanyRatings[5] = companyScore.PreparednessRating;
            CompanyRatings[6] = companyScore.QualitativePerformanceRating;
            CompanyRatings[7] = companyScore.QuantitativePerformanceRating;
        }
    }
}